package kin.interceptor.system;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class SessionInterceptor extends HandlerInterceptorAdapter{

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		if(request.getSession(false)==null){
			response.addIntHeader("sessionIsExpired",1);
			System.out.println("Session has been invalidated!");
		return true;}
			  // System.out.println("Session has been invalidated!");
			else{
				response.addIntHeader("sessionIsExpired",0);
				System.out.println("Session has av!");
		    return true;
			}
		
		
	}

	
}
